﻿using SerialPort_Assistant.Enums;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SerialPort_Assistant.Common
{
    [ValueConversion(typeof(string), typeof(bool))]
    public class SendTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return EnumUtil.Compare<SendTypes>(value, parameter);
        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Enum.Parse(typeof(SendTypes), parameter.ToString());
        }
    }
}
